package cate.game.util;

import cate.game.ManyGame;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/** ManyGame合计信息 */
public class GameSumInfo {

    public List<String> groupCodeList;

    public List<Integer> srvIdList;

    public GameSumInfo read(ManyGame games) {
        srvIdList = new ArrayList<>();
        Set<String> groupCodeSet = new HashSet<>();
        games.getAll().forEach(g -> {
            groupCodeSet.add(g.config.gs.getGroupCode());
            srvIdList.add(g.config.srvId);
        });
        groupCodeList = groupCodeSet.stream().collect(Collectors.toList());
        return this;
    }

    public boolean containsGroupCode(String groupCode) {
        return groupCodeList.contains(groupCode);
    }

}
